package com.roger.myHome.service.impl;

import com.roger.myHome.convert.IReqMapper;
import com.roger.myHome.domain.TbLottery;
import com.roger.myHome.entity.dto.LotteryAddReq;
import com.roger.myHome.entity.qto.LotteryQTO;
import com.roger.myHome.mapper.LotteryMapper;
import com.roger.myHome.page.EUDataGridResult;
import com.roger.myHome.service.LotteryService;
import com.roger.myHome.util.SystemUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service
@Slf4j
public class LotteryServiceImpl implements LotteryService {
    @Resource
    private LotteryMapper lotteryMapper;

    @Override
    public EUDataGridResult page(LotteryQTO qtoReq) {
        return new EUDataGridResult(lotteryMapper.page(qtoReq), lotteryMapper.totalSize(qtoReq));
    }

    @Override
    public String add(LotteryAddReq addReq) {
        TbLottery entity = IReqMapper.INSTANCE.add2DO(addReq);
        //entity.setBuyDate();
        entity.setId(SystemUtil.getId());
        entity.setCreateTime(new Date());
        log.info("{}",entity);
        return null;
    }
}
